package com.kumi.crowd.util;

/**
 * 返回结果
 */
public class Result<T> {

    private String result;

    private String massage;

    private T data;

    public static <Type> Result<Type> success(){
        return new Result<Type>(ResultData.SUCCESS,null,null);
    }

    public static <Type> Result<Type> successData(Type type){
        return new Result<Type>(ResultData.SUCCESS,null,type);
    }

    public static <Type> Result<Type> failed(String massage){
        return new Result<Type>(ResultData.FAILED,massage,null);
    }


    public Result() {
    }

    public Result(String result, String massage, T data) {
        this.result = result;
        this.massage = massage;
        this.data = data;
    }

    public String getResult() {
        return result;
    }

    public void setResult(String result) {
        this.result = result;
    }

    public String getMassage() {
        return massage;
    }

    public void setMassage(String massage) {
        this.massage = massage;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return "Result{" +
                "result='" + result + '\'' +
                ", massage='" + massage + '\'' +
                ", data=" + data +
                '}';
    }
}
